﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartHotel.BLL;
using SmartHotel.DAL;
using SmartHotel.Model;

namespace SmartHotel.WebAPI.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RoomTypeController : ControllerBase
    {
        public RoomTypeController(RoomTypeBLL roomTypeBLL)
        {
            RoomTypeBLL = roomTypeBLL;
        }

        public RoomTypeBLL RoomTypeBLL { get; }

        [HttpPost]
        public int Add(RoomType roomType)
        {
            return RoomTypeBLL.Add(roomType);
        }
        //查询
        [HttpGet]
        public RoomType GetRoomTypeById(int id)
        {
            return RoomTypeBLL.GetRoomTypeById(id);
        }
        [HttpDelete]
        public int Delete(int id)
        {
            return RoomTypeBLL.Delete(id);
        }
        //更新
        [HttpPut]
        public int Update(RoomType roomType)
        {

            return RoomTypeBLL.Update(roomType);
        }
        /// <summary>
        /// 获取所有房型
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public List<RoomType> GetRoomTypes()
        {
            return RoomTypeBLL.GetRoomTypes();
        }
    }
}
